<!--
 * @Author: yantong 11608542+yan_tongone@user.noreply.gitee.com
 * @Date: 2023-01-05 17:47:30
 * @LastEditors: yantong 11608542+yan_tongone@user.noreply.gitee.com
 * @LastEditTime: 2023-01-06 17:34:28
 * @FilePath: \vue-admin-template-master\src\views\employees\component\UserInfo.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--  -->
<template>
  <div class="user-info">
    <el-form
      :model="ruleForm"
      ref="ruleForm"
      label-width="140px"
      class="demo-ruleForm"
    >
      <p>基础信息</p>
      <!-- 岗位 -->
      <el-row :gutter="10">
        <el-col :span="10">
          <el-form-item label="岗位" class="two">
            <el-input v-model="ruleForm.post"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 转正状态 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="转正状态" class="two">
            <el-select
              v-model="ruleForm.stateOfCorrection"
              placeholder="请选择"
              disabled
            >
              <el-option
                v-for="item in stateOfCorrection"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 职级 -->
      <el-row :gutter="10">
        <el-col :span="10">
          <el-form-item label="职级">
            <el-input v-model="ruleForm.rank"></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 转正评价 -->
      <el-row :gutter="10">
        <el-col :span="24">
          <el-form-item label="转正评价">
            <el-input
              type="textarea"
              v-model="ruleForm.correctionEvaluation"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 汇报对象 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="汇报对象" class="two">
            <el-select v-model="ruleForm.reportName" placeholder="请选择">
              <el-option
                v-for="item in reportName"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- HRBP -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="HRBP" class="two">
            <el-select v-model="ruleForm.hrbp" placeholder="请选择">
              <el-option
                v-for="item in reportName"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 调整司龄天 -->
      <el-row :gutter="10">
        <el-col :span="10">
          <el-form-item label="调整司龄天">
            <el-input
              type="text"
              v-model="ruleForm.adjustmentAgedays"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 首次参加工作时间 -->
      <el-row :gutter="10">
        <el-col :span="9">
          <el-form-item label="首次参加工作时间" class="two">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.workingTimeForTheFirstTime"
              style="width: 100%"
            ></el-date-picker> </el-form-item
        ></el-col>
      </el-row>

      <!-- 调整工龄天 -->
      <el-row :gutter="10">
        <el-col :span="10">
          <el-form-item label="调整司龄天">
            <el-input
              type="text"
              v-model="ruleForm.adjustmentOfLengthOfService"
              placeholder="请输入"
              disabled
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- ================================================= -->

      <p>合同信息</p>
      <!-- 首次合同开始时间 -->
      <el-row :gutter="10">
        <el-col :span="9">
          <el-form-item label="首次合同开始时间" class="two">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.initialContractStartTime"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 首次合同结束时间 -->
      <el-row :gutter="10">
        <el-col :span="9">
          <el-form-item label="首次合同结束时间" class="two">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.firstContractTerminationTime"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 现合同开始时间 -->
      <el-row :gutter="10">
        <el-col :span="9">
          <el-form-item label="现合同开始时间" class="two">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.currentContractStartTime"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 现合同结束时间 -->
      <el-row :gutter="10">
        <el-col :span="9">
          <el-form-item label="现合同结束时间" class="two">
            <el-date-picker
              type="date"
              placeholder="选择日期"
              v-model="ruleForm.closingTimeOfCurrentContract"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 合同期限 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="合同期限" class="two">
            <el-select v-model="ruleForm.contractPeriod" placeholder="请选择">
              <el-option
                v-for="item in contractPeriod"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 续签次数 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="续签次数" class="two">
            <el-select v-model="ruleForm.renewalNumber" placeholder="请选择">
              <el-option
                v-for="item in renewalNumber"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <p>招聘信息</p>

      <!-- 其他招聘渠道 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="其他招聘渠道" class="two">
            <el-select
              v-model="ruleForm.otherRecruitmentChannels"
              placeholder="请选择"
            >
              <el-option
                v-for="item in otherRecruitmentChannels"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 招聘渠道 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="续签次数" class="two">
            <el-select
              v-model="ruleForm.recruitmentChannels"
              placeholder="请选择"
            >
              <el-option
                v-for="item in recruitmentChannels"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 社招校招 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-form-item label="社招校招" class="two">
            <el-select
              v-model="ruleForm.socialRecruitment"
              placeholder="请选择"
            >
              <el-option
                v-for="item in socialRecruitment"
                :key="item"
                :label="item"
                :value="item"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>

      <!-- 推荐企业人 -->
      <el-row :gutter="10">
        <el-col :span="10">
          <el-form-item label="推荐企业人">
            <el-input
              type="text"
              v-model="ruleForm.recommenderBusinessPeople"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="10">
        <el-col :span="24">
          <el-form-item>
            <el-button type="primary" @click="setPosition(detailId)">保存更新</el-button>
            <el-button>返回</el-button>
          </el-form-item>
        </el-col>
      </el-row>

      <!--  -->
    </el-form>
  </div>
</template>

<script>
import { getPosition, setPosition } from "@/api/employees";
import UploadView from "./UploadView.vue";
export default {
  name: "Com",
  data() {
    return {
      ruleForm: {
        post: "124", //岗位
        stateOfCorrection: "", //转正状态
        rank: "sdad", //职级
        correctionEvaluation: "111111", //转正评价
        reportName: "", //汇报对象
        hrbp: "", //HRBP
        adjustmentAgedays: "", //调整司龄天
        workingTimeForTheFirstTime: "", //首次参加工作时间
        adjustmentOfLengthOfService: "", //调整工龄天

        initialContractStartTime: "", //首次合同开始时间
        firstContractTerminationTime: "", //首次合同结束时间
        currentContractStartTime: "", //现合同开始时间
        closingTimeOfCurrentContract: "", //现合同结束时间
        contractPeriod: "24月", //合同期限
        renewalNumber: "2", //续签次数

        otherRecruitmentChannels: "拉勾网", //其他招聘渠道
        recruitmentChannels: "校园宣讲", //招聘渠道
        socialRecruitment: "校招", //社招校招
        recommenderBusinessPeople: "123", //推荐企业人
      },
      stateOfCorrection: ["未转正", "已转正"],
      reportName: [
        "小黑子2.0糊涂",
        "馒头怎么这么卡，攻击服务器？",
        "12小黑子长得丑急了你们就黑我家鸽鸽吧 ",
        "你们越黑他就越火 他越火烤出来就越香前有关羽铺路",
        "后有空白跟班好难啊胡图图000测试123",
        "传播正能量",
        "36D宋高昂师",
        "玉堂武高丽任志行陈扬切克闹",
        "关羽38关羽68关羽71",
        "关羽72",
        "关羽73",
        "关羽74",
        "关羽75关羽76关羽77关羽113关羽114关羽115关羽116关羽117关羽118关羽119关羽120关羽121关羽122关羽123关羽124关羽12关羽126关羽127关羽128关羽129关羽130关羽131关羽132关羽133关羽134关羽135关羽136",
        "关羽137关羽138关羽139关羽140关羽141关羽142关羽143关羽144扶苏关羽146",
        "关羽147关羽148关羽149关羽150关羽151关羽152关羽153关羽154",
        "关羽155关羽156关羽157关羽158关羽159关羽160关羽161关羽162关羽163关羽164关羽165关羽166关羽167关羽168关羽169关羽170",
        "关羽396关羽397关羽398关羽399关羽400关羽401",
      ],
      contractPeriod: ["6月", "12月", "24月", "36月", "其他"],
      renewalNumber: ["0次", "1次", "2次", "3次", "4次或以上"],
      otherRecruitmentChannels: [
        "智联招聘",
        "拉勾网",
        "前程无忧",
        "猎聘网",
        "校园宣讲",
        "猎头",
        "内部推荐",
      ],
      recruitmentChannels: [
        "智联招聘",
        "拉勾网",
        "前程无忧",
        "猎聘网",
        "校园宣讲",
        "猎头",
        "内部推荐",
      ],

      socialRecruitment: ["社招", "校招"],
    };
  },
  props: ["detailId"],
  components: { UploadView },
  created() {
    console.log(this.detailId, "id");
  },
  computed: {},

  mounted() {
    // 获取员工详情的个人信息
    this.getPosition(this.detailId);
  },

  methods: {
    async getPosition(id) {
      let res = await getPosition({ id });
      console.log(res, "resdsvsfsdzdfesdddd");
    },


    async setPosition(id){
      let res=await setPosition({id,...this.ruleForm})
      console.log(res,"保存");

      this.$message.success('保存成功')
    }
  },
  watch: {},
  mixins: [],
};
</script>
<style scoped lang="scss">
.user-info {
  padding: 0 40px;
  box-sizing: border-box;
  .rightCol {
    text-align: right;
    float: right;
  }
  .two {
    width: 90%;
  }
  .el-select {
    width: 100%;
  }
}
</style>
